/**
 * Created by zhaizy on 2015/3/26.
 */

angular.module("test", [])

    .controller("GetForResultController", function ($scope, $state, $ionicHistory, $stateParams) {
        console.log("$stateParams is " + $stateParams.from + " " + $stateParams.data + $state.$current);

        var from = $stateParams.from;

        $scope.data = $stateParams.data;

        $scope.items = [{name: "测试", id: 111}, {name: "测试22", id: 222, selected: true}, {name: "测试3", id: 333}];

        $scope.selectItem = $scope.items[1];

        $scope.okClick = function () {
            //var defered = $state.promises[from];
            //console.log("the defered is " + defered + " " + $scope.data);
            //defered.resolve($scope.data);

            $state.setResult(from, $scope.data);

        }
    })